<template>
  <div>
    <h1>新闻表</h1>
    <table border="1" cellspacing="0" align="center">
      <tr>
        <td>id</td>
        <td>标题</td>
        <td>操作</td>
        <td>次数</td>
      </tr>
      <tr v-for="i in data">
        <td>{{ i.id }}</td>
        <td>{{ i.name }}</td>
        <router-link :to="{name:'look',query:{id:i.id}}">查看</router-link>
        <td>{{ i.couter }}</td>
      </tr>
    </table>
  </div>
</template>

<script>
export default {
  name: "news",
  data() {
    return {
      data: ''
    }
  },
  methods: {
    getnews() {
      this.axios.get('new/')
        .then(res => {
          console.log(res)
          this.data = res.data
        })
    }
  },
  mounted() {
    this.getnews()
  }
}
</script>

<style scoped>

</style>
